package cn.agiledata.bank.common.dao;

import java.io.InputStream;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Set;

import javax.servlet.http.HttpServletRequest;

import org.hibernate.HibernateException;

import cn.agiledata.bank.common.util.PageBean;
import cn.agiledata.bank.hibernateBean.Account;
import cn.agiledata.bank.hibernateBean.AccountBalance;
import cn.agiledata.bank.hibernateBean.AccountBank;
import cn.agiledata.bank.hibernateBean.AccountHis;
import cn.agiledata.bank.hibernateBean.MoneyRole;
import cn.agiledata.bank.hibernateBean.Operator;
import cn.agiledata.bank.hibernateBean.PeerInnerAccount;
import cn.agiledata.bank.hibernateBean.SubAccount;
import cn.agiledata.bank.hibernateBean.Sysbook;
import cn.agiledata.bank.myspace.bean.AccountHisQueryDetailBean;
import cn.agiledata.bank.myspace.bean.PaperBean;

public interface AccountTemplateInter {

	/**
	 * acc 需要保存的account对象 photoPath 图片路径 cardPhotoPath 卡图片路径
	 */
	public void update(AccountBalance accBalance);

	public List getAllSubAccountsByMainId(String id);

	public boolean ifHasBank(String bankId);

	public List getSubAccountsByAccountId(String id);

	public void saveOrUpdateAccount(Account acc, InputStream photoSteam, InputStream cardPhotoStream, InputStream cardPhotoBackStream)
			throws Exception;

	public void saveOrUpdateAccount(Account acc, String photoStream, String cardPhotoStream) throws Exception;

	public SubAccount getSubAccountByAccountId(String id);

	public Account getAccountByName(String accountName);

	public int ifCanCall(String subAccountId, String moduleType);

	public List getSetup(String subAccountId);

	public List getTran(String subAccountId);

	public boolean saveOrUpdateSetup(List list);

	public PeerInnerAccount getPeerAcctHis(String peerAcctSeq, String acctSeq);

	public boolean ifAccountIsEffect(double checkAccount);

	public int compareAccountMoney(String SubAccountId, Double wantedCount);
	
	public String accountMoney(String SubAccountId);

	public boolean compareAccountPickUpPassword(Account account, String wantedPassword);

	public boolean corCompareAccountPickUpPassword(Operator operator, String wantedPassword);

	public void saveObj(Object obj);

	public PageBean getAccountListPageBeanBussiness(List id, int startPage, int pageSize);

	public PageBean getAccountListPageBeanDownSite(Object[] para, int startPage, int pageSize, String actionType);

	public PageBean getAccountHisListPageBean(Map param, int pageNo, int recordPerPage);

	public List getInsideAccount();

	public SubAccount getRemitAccount();

	public SubAccount getBankSubAccount();

	public SubAccount getDownSiteSubAccount();
	
	public SubAccount getCardSubAccount();

	/**
	 * 支付利息的内部账户
	 * 
	 * @author johnny
	 */
	public SubAccount getInterestSubAccount();

	public SubAccount getSubAccount(String id);

	public SubAccount getSubAccountByAccount(String id);

	public Account getAccount(String id);

	// public Account getAccountByAccountID(String id);

	public boolean updateAccount(Account account);

	public boolean saveHisAccount(AccountHis accountHis);

	public AccountBank getAccountBank(String l);

	public List getAccountBankListByAccountIdAndBankName(String AccountId, String bankName);

	public AccountHisQueryDetailBean getAccountHisQueryDetail(String TransactionID, String accountID);

	public List getAccountHisQueryList(Map param, int pageNo, int recordPerPage);

	public int getAccountHisCount(Map parameter);

	public boolean isNull(Object o);

	public boolean ifHasAccountInPeer(String id, String acctSeq);

	public void saveAccountInPeer(PeerInnerAccount pah);

	public PeerInnerAccount addAccountInPeer(Account peerAcct, String acctSeq, String type);

	public List getPeerAccountListById(String id);

	public boolean ifExistAccount(String email);

	public PeerInnerAccount getPeerAcctHisByID(String id);

	public void removePeerAccount(String acctID);

	public String getNameByEmail(String email);

	public List getAccountHisList(String subAccountId);

	public List getExistDefaultBank();

	public List getAcctBalHisList(Map param, int pageNo, int recordPerPage);

	public int getAcctBalHisCount(Map param);

	public PageBean getAcctBalHisPageBean(Map param, int pageNo, int recordPerPage);
	
	//获取指定用户指定时间点之前的各子账户余额的和，如果不指定时间点，不设置查询时的时间条件
	public BigDecimal getTotalAccountBalance(Long accountId, Date beforeDate);
	
	//获取指定子账户指定时间点之前的可用余额，如果不指定时间点，不设置查询时的时间条件
	public BigDecimal getSubAccountBalance(Long subAccountId, Date beforeDate);
	
	public void saveAcctHis(AccountHis acctHis);

	/**
	 * 提供所有子账户，以便逐一为其结算利息; 非内部账户之有效、普通用户； 即 Account.countType!='C'
	 * SubAccount.ValidFlag=='Y' SubAccount.SubAccountType=='0'
	 * 
	 * @author johnny
	 */
	public List getAllSubAccount4Interest();

	/**
	 * 综合积分要求新增此接口
	 */
	public List getAllAccount4Interest();

	// ivr
	/**
	 * 根据账户accountId得到账户对象
	 */
	public Account getAccountByAccountId(String id);

	/**
	 * 根据账户accountId得到IVR子账户对象
	 * 
	 * @param id
	 */
	public SubAccount getIvrSubAccountByAccountId(String id);

	/**
	 * 根据账户accountId得到该账户的默认子账户
	 * 
	 * @param id
	 * @return
	 */
	public SubAccount getDefaultSubAccountByAccountId(String id);

	public void updateSubAccount(SubAccount sub);

	public List getAccountListByIdcardStatus(String idcardStatus);

	public List getAccountListByIdcardNo(String idcardNo);

	public Double getAmountByTransaction(String accountId, String date);

	public Double getRevenueByTransaction(String accountId, String date);
	
	public Double getDrawByTransaction(String accountId, String date);
	
	public Double getAccBalHis(Set set, String date);

	public Sysbook getDateRestrictions();

	public Sysbook getDatePermit();

	public String ifHasEmail(String email);

	public String isEmail(String email);

	public String isMobile(String mobile);

	public String ifHasMobile(String mobile);

	public String isEmpty(String data);

	public String getAccountNameByName(String accountName);

	public SubAccount getSubAccountByEmailMobile(String msg);

	public PaperBean getPaper(String TransactionID, String accountID);

	// 判断卡号是否唯一
	public boolean isUniqueAccountBank(String accountId, Long accountSeq, Long id) throws HibernateException;

	// 判断别名是否唯一
	public boolean isUniqueAccountAlias(String bankAlias, Long accountSeq, Long id) throws HibernateException;

	public SubAccount getSubAccountBySubAccountId(String subAccountId);
	
	public String b2cavaiable(String email);
	
	public SubAccount getReturnAccount();
	
	/**
	 * 根据交易记录汇总收款总金额
	 * 统计地震捐款使用
	 * 
	 * @param account
	 * @return
	 */
	public Object[] sumAmountByTrans(Account account);
	
	/**
	 * 查询所有收入记录
	 * 统计地震捐款使用
	 * 
	 * @param account
	 * @return
	 */
	public PageBean getAllCreditTrans(Account account, int pageNo, int recordPerPage);
	
	public void noticeMoenyRole(MoneyRole moneyRole,String amount,Account acct)throws Exception;
	
	public String confirmToRuleByTransfer(String amount,HttpServletRequest request)throws Exception;

	
}